1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | {attribute 'pack_mode' := '4'} {attribute 'reflection'} FUNCTION_BLOCK JSONVAR VAR {attribute 'instance-path'}{attribute 'noinit'} _VarNameArray: ARRAY[1..GPL_JSON.MAX_LEVELS] OF JSONVARNAME;//variable path as an array. [1] is variable name, [2..x] are higher level structures {attribute 'hide'}_InternalValue: ARRAY[1..GPL_JSON.MAX_VALUE_SIZE+1] OF BYTE; //value stored internally as an array of bytes {attribute 'hide'}_ParentVar: INT; //array position which points to the highest variable name END_VAR VAR_STAT {attribute 'hide'}PrevNameArray: REFERENCE TO ARRAY[1..GPL_JSON.MAX_LEVELS] OF JSONVARNAME;//path of the previous variable variable type and size are automatically determined when a value is set, either: -with any of the set accessors of the CharString, Boolean, Integer, Number, or Null properties variable name is set automatically in FB_Init -variable name is the JSON name "3h", etc. Workaround is to put an underscore at the beginning of the variable name. This will ========================================================================================================*) |